package com.hw.springhbase.conf;

import org.apache.hadoop.hbase.HBaseConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class HbaseConfig {
	
	private static Logger log=LoggerFactory.getLogger(HbaseConfig.class);
	@Value("${hbase.zookeeper.quorum}")
    private String zookeeperQuorum;
 
    @Value("${hbase.zookeeper.property.clientPort}")
    private String clientPort;
 
    @Value("${hbase.zookeeper.znode.parent}")
    private String znodeParent;
    
    @Value("${hbase.client.keyvalue.maxsize}")
    private String maxsize;
    
    @Bean("hbaseconfig")
    public org.apache.hadoop.conf.Configuration hbaseconfig() {
    	org.apache.hadoop.conf.Configuration conf= HBaseConfiguration.create();
//    	org.apache.hadoop.conf.Configuration conf = new org.apache.hadoop.conf.Configuration();
        conf.set("hbase.zookeeper.quorum", zookeeperQuorum);
        conf.set("hbase.zookeeper.property.clientPort", clientPort);
        conf.set("zookeeper.znode.parent", znodeParent);
        conf.set("hbase.client.keyvalue.maxsize", maxsize);
        log.debug("配置初始化");
        return conf;
    }
    

}
